package alg.collection;

import java.util.ArrayList;

/**
 * @author:yuziji
 * @create: 2023-04-20 20:00
 */
public class MyArrayList {
    private int[] data;
    private int initCapacity;
    private int size;

    public MyArrayList(){
        this(10);
    }

    public MyArrayList(int initCapacity){
        this.initCapacity = initCapacity;
        this.data = new int[0];
    }

    public void add(int value){
        ensureCapacity();
        data[size++] = value;

    }

//    判断是否需要扩容
    private void ensureCapacity() {
        if (data.length==0){
            data = new int[initCapacity];
            return;
        }
        if (size>=data.length){

        }
    }
}
